package com.backedserver.controller.index;

import com.common.requestvo.index.JudicialCheckDetailsChartReqVo;
import com.common.requestvo.judicialcheck.JudicialTargetTypeSumCheckRankReqVo;
import com.common.service.index.IndexPageService;
import com.common.utils.ResultVoUtil;
import com.common.vo.ResultVo;
import com.common.vo.index.CaseDistributeVo;
import com.common.vo.index.JudicialCaseDistributeVo;
import com.common.vo.index.JudicialCheckChartVo;
import com.common.vo.index.JudicialDistributeVo;
import com.common.vo.judicialcheck.JudicialTargetTypeSumCheckVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author johnny
 * @create 2021-05-18 8:42 下午
 **/

@Api(tags = "首页模块")
@RestController
@RequestMapping("/indexPage")
@Slf4j
public class IndexController {


    private final IndexPageService indexPageService;


    public IndexController(IndexPageService indexPageService) {
        this.indexPageService = indexPageService;
    }

    @GetMapping("/judicialDistribute")
    @ApiOperation(value = "检察官分布")
    public ResultVo judicialDistribute() {
        List<JudicialDistributeVo> judicialDistributeVos = indexPageService.judicialDistribute();
        return ResultVoUtil.success(judicialDistributeVos);
    }

    @GetMapping("/scoreChartRanking")
    @ApiOperation(value = "查询图表 个人类型考核总计信息")
    public ResultVo scoreChartRanking(JudicialTargetTypeSumCheckRankReqVo judicialTargetTypeSumCheckRankReqVo) {
        List<JudicialTargetTypeSumCheckVo> judicialTargetTypeSumCheckVos = indexPageService.scoreChartRanking(judicialTargetTypeSumCheckRankReqVo);
        return ResultVoUtil.success(judicialTargetTypeSumCheckVos);
    }

    @GetMapping("/scoreDetails")
    @ApiOperation(value = "查询图表 个人类型考核总计信息")
    public ResultVo scoreDetails(JudicialCheckDetailsChartReqVo judicialCheckDetailsChartReqVo) {
        JudicialCheckChartVo judicialCheckChartVo = indexPageService.scoreDetails(judicialCheckDetailsChartReqVo);
        return ResultVoUtil.success(judicialCheckChartVo);
    }


    @GetMapping("/caseDistribute")
    @ApiOperation(value = "案件统计")
    public ResultVo caseDistribute() {
        List<CaseDistributeVo> caseDistributeVos = indexPageService.caseDistribute();
        return ResultVoUtil.success(caseDistributeVos);
    }


    @GetMapping("/judicialCaseDistribute")
    @ApiOperation(value = "检察官司法办案")
    public ResultVo judicialCaseDistribute() {
        List<JudicialCaseDistributeVo> judicialCaseDistribute = indexPageService.judicialCaseDistribute();
        return ResultVoUtil.success(judicialCaseDistribute);
    }

}